import config from "@/config"
import http from "@/utils/request"
/**
 * 日报
 */
export default {
  getDailyList: {
    url: `${config.API_URL}/dailyLogs/normalList`,
    name: "获取日报列表",
    get: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  getReceiveList: {
    url: `${config.API_URL}/dailyLogs/receiveList`,
    name: "获取我收到的汇报列表",
    get: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  getDailyMonthList: {
    url: `${config.API_URL}/dailyLogs/list`,
    name: "获取月日报列表",
    get: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  getDailyById: {
    url: `${config.API_URL}/dailyLogs/showCertainOne`,
    name: "根据id查日报详情",
    post: async function (data = {}) {
      return new Promise((resolve, reject) => {
        http.postParam(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  add: {
    url: `${config.API_URL}/dailyLogs/add`,
    name: "添加日报",
    post: async function (data) {
      return new Promise((resolve, reject) => {
        http.post(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  }
}